import 'package:enterprise_v6_app/app/components/custom_app_bar.dart';
import 'package:enterprise_v6_app/app/components/custom_modele/custom_card.dart';
import 'package:enterprise_v6_app/app/components/custom_modele/custom_row_purple.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/modules/application/special_operation/standing_book_page/operating_ledger_page/operating_ledger_details_page/interrupt_record_page.controller.dart';

/// 中断记录
class InterruptRecordPage extends StatelessWidget {
  InterruptRecordPage({super.key});

  final controller = Get.put(InterruptRecordPageController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.bg_color_grey,
      appBar: CustomAppBar(
        titleText: '中断记录',
      ),
      body: Container(
        padding: EdgeInsets.all(16.w),
        child: ListView.separated(
            itemCount: controller.data.length,
            itemBuilder: (context, index) {
              return CustomCard(
                title: '中断时间：${controller.data[index].interruptDate}',
                content: Column(
                  children: [
                    Container(
                      height: 1,
                      color: AppColors.bg_color_grey,
                    ),
                    AppGaps.vGap12,
                    Row(
                      children: [
                        Text(
                          '作业中断原因：',
                          textAlign: TextAlign.left,
                          style: TextStyle(
                            fontSize: 12.sp,
                            color: AppColors.font_color_black,
                            fontWeight: FontWeight.w500,
                          ),
                        ),
                      ],
                    ),
                    AppGaps.vGap12,
                    Container(
                      padding: EdgeInsets.all(8.w),
                      decoration: BoxDecoration(
                        color: const Color(0xFFF7F7FB),
                        borderRadius: BorderRadius.circular(6.w),
                        border: Border.all(
                          color: const Color(0xFFEBEDF0),
                          width: 1.w,
                        ),
                      ),
                      child: SizedBox(
                        width: double.infinity,
                        child: Text(
                          '${controller.data[index].interruptReason}',
                          textAlign: TextAlign.left,
                          style: TextStyle(
                            fontSize: 13.sp,
                            color: AppColors.font_color_gray,
                          ),
                        ),
                      ),
                    ),
                    AppGaps.vGap12,
                    CustomRowPurple(
                      title: '作业开启时间：',
                      color: const Color(0xFF495061),
                      content: '${controller.data[index].interruptStartDate}',
                    )
                  ],
                ),
              );
            },
            separatorBuilder: (context, index) {
              return AppGaps.vGap16;
            }),
      ),
    );
  }
}
